<template>
  <div class="nav-bar">
    <a class="item" v-for="item in recommends.slice(0,4)" :key="item.id" @click.prevent="goD(item.id)">
      <img v-lazy="item.cover_url" alt="">
      <div>{{item.title}}</div>
    </a>

  </div>
</template>

<script>
import router from "@/router";

export default {
  props:{
    recommends:{
      type:Array,
      default(){
        return []
      }
    }
  },
  setup(){
    const goD=(id)=>{
      router.push({path:'/detail',query:{id}})
    }
    return{goD}
  }


}
</script>

<style scoped lang="scss">
.nav-bar{
  width: 100%;
  display: flex;
  text-align: center;
  padding: 15px 0 15px;
  border-bottom: 8px solid #eee;
  .item{
    flex: 1;
    img{
      width: 70px;
      height: 70px;
      margin-bottom: 6px;
    }
    div{
      font-size: 14px;
    }
  }
}
</style>
